﻿Imports System
Imports System.Workflow.ComponentModel

Namespace System.Workflow.Activities
    <Serializable> _
    Friend Class UnsubscribeAction
        Inherits StateMachineAction
        ' Methods
        Friend Sub New(ByVal stateName As String, ByVal eventDrivenName As String)
            MyBase.New(stateName)
            Me._eventDrivenName = eventDrivenName
        End Sub

        Friend Overrides Sub Execute(ByVal context As ActivityExecutionContext)
            MyBase.Execute(context)
            Dim eventDriven As EventDrivenActivity = DirectCast(MyBase.State.Activities.Item(Me.EventDrivenName), EventDrivenActivity)
            MyBase.SubscriptionManager.UnsubscribeEventDriven(context, eventDriven)
        End Sub


        ' Properties
        Friend ReadOnly Property EventDrivenName As String
            Get
                Return Me._eventDrivenName
            End Get
        End Property


        ' Fields
        Private _eventDrivenName As String
    End Class
End Namespace

